﻿
@{
    ViewBag.Title = "PassWord";
    Layout = "~/Views/Shared/_MyLayoutPage.cshtml";
}


<div class="layui-row">
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
    <div class="layui-col-lg4">
        <input type="password" name="title" id="OldPass" required lay-verify="required" placeholder="旧密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
</div>
<div style="height:20px;"></div>
<div class="layui-row">
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
    <div class="layui-col-lg4">
        <input type="password" name="title" id="NewPass" required lay-verify="required" placeholder="输入新密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
</div>
<div style="height:20px;"></div>
<div class="layui-row">
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
    <div class="layui-col-lg4">
        <input type="password" name="title" id="ComfirPass" required lay-verify="required" placeholder="确认新密码" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
</div>
<div style="height:20px;"></div>
<div class="layui-row">
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
    <div class="layui-col-lg4">
        <button type="button" class="layui-btn" id="Confirm" lay-filter="formDemo">确定</button>
    </div>
    <div class="layui-col-lg4"><div>&nbsp;</div></div>
</div>

<script type="text/javascript">

    layui.use(['form', 'table', 'upload', 'layer'], function () {
        var layer = layui.layer;



        $("#Confirm").on("click", function () {
            var OldPass = $("#OldPass").val();
            var NewPass = $("#NewPass").val();
            var ComfirPass = $("#ComfirPass").val();

            if (OldPass == "" || NewPass == "" || ComfirPass == "") {
                alert("输入错误");
                return;
            }

            var data = {};
            data["OldPass"] = OldPass;
            data["NewPass"] = NewPass;
            data["ComfirPass"] = ComfirPass;

            $.ajax({
                type: "POST",
                url: "/Api/PassWordChange",
                async: false,
                contentType: "application/json",
                dataType: "json",
                data: JSON.stringify(data),
                success: function (msg) {
                    if (msg.result == "OK") {
                        layer.msg('修改成功', { icon: 6, time: 3000 });
                        $("#OldPass").val("");
                        $("#NewPass").val("");
                        $("#ComfirPass").val("");

                    } else {
                        alert(msg.result);
                    }
                }
            });
        });
    });








</script>

